{literal}
<script>
$(document).ready( function() 
{
	$("select.st_multi").multiSelect
	({ 
		selectAllText		: 'Select all',
		noneSelected		: 'Click for choose',
		oneOrMoreSelected	: 'You have chosen <strong>%</strong> items' ,
		selWidth			: 250			
	});				
});

function doAddColumn()
{
	hide_all_error();
	var iCheck	= 0;
	var eFocus	= '';
	
	var id		= 'strColumnName';
	var e		= $('#'+id);
	var column	= e.val();
	if( !e.val() )
	{
		iCheck 	= 1;
		eFocus	= eFocus ? eFocus : e;
		show_error(id, 'null');
	}
	
	var id		= 'intDataType';
	var e		= $('#'+id);
	var datatype= e.val();
	if( e.val()=='-1' || e.val()==-1)
	{
		iCheck 	= 1;
		eFocus	= eFocus ? eFocus : e;
		show_error(id, 'null');
	}
	
	if(iCheck==1)
	{
		eFocus.focus();
		return;
	}
	
	showWaiting();
	$.post(
		HOST_ADMIN + '/forecast/add-column',
		{
			'c'	: column,
			't'	: datatype
		},
		function(data)
		{
			if(data.result=='1' || data.result==1){
				show_error('strColumnName', 'err');
			}
			else{
				window.location.href = window.location.href;
			}
		},
		'json'
	);
}
</script>
<style>
	.search-div{float:left; width:2000px;}
	.search-div .l{float:left; width:1150px}
	.search-div .r{float:right; width:600px}
	
	span.status .multiSelectOptions{margin-left:449px; width:120px; margin-top:-10px}
	span.status a.multiSelect{margin-top:7px}
</style>
{/literal}
	
<div class="search-div">
	<div class="l">
		<fieldset id="fieldsetID">
			<legend>Search</legend>
			<form method="get" action="">
			<div style="margin-bottom:10px;">
				<label>SKU Or Name : </label><input type="text" size="42" name="sku" value="{$strSku}" />
				<label>Supplier: </label> 
				<span class="status">
					<select name="supplier" id="supplier">
					<option value="">All supplier</option>
					 {foreach from=$arrSupplier item=item}
							<option value="{$item.id}" {if $item.id==$strSupplier} selected{/if}>{$item.name}</option>
					 {/foreach}
					</select>
				</span>

				<label>Total sales :</label>
				<select name="total">
					<option value="" {if $strTotalSales==''} selected="selected"{/if}>&nbsp;&nbsp;All&nbsp;&nbsp;</option>	
					<option value="11" {if $strTotalSales=='11'} selected="selected"{/if}>&nbsp;&nbsp;> 0 &nbsp;&nbsp; </option>
					<option value="1"{if $strTotalSales=='1'} selected="selected"{/if}>&nbsp;&nbsp;> 1 &nbsp;&nbsp; </option>
					<option value="2"{if $strTotalSales=='2'} selected="selected"{/if}>&nbsp;&nbsp;> 2 &nbsp;&nbsp; </option>
					<option value="3"{if $strTotalSales=='3'} selected="selected"{/if}>&nbsp;&nbsp;> 3 &nbsp;&nbsp; </option>
					<option value="4"{if $strTotalSales=='4'} selected="selected"{/if}>&nbsp;&nbsp;> 4 &nbsp;&nbsp; </option>
					<option value="5"{if $strTotalSales=='5'} selected="selected"{/if}>&nbsp;&nbsp;> 5 &nbsp;&nbsp; </option>
					<option value="6"{if $strTotalSales=='6'} selected="selected"{/if}>&nbsp;&nbsp;> 6 &nbsp;&nbsp; </option>
					<option value="7"{if $strTotalSales=='7'} selected="selected"{/if}>&nbsp;&nbsp;> 7 &nbsp;&nbsp; </option>
					<option value="8"{if $strTotalSales=='8'} selected="selected"{/if}>&nbsp;&nbsp;> 8 &nbsp;&nbsp; </option>
					<option value="9"{if $strTotalSales=='9'} selected="selected"{/if}>&nbsp;&nbsp;> 9 &nbsp;&nbsp; </option>
					<option value="10"{if $strTotalSales=='10'} selected="selected"{/if}>&nbsp;&nbsp;>10 &nbsp;&nbsp; </option>
				</select>

				<label>ASL :</label>
				<select name="asl">
					<option value="" {if $strASL==''} selected="selected"{/if}>&nbsp;&nbsp;All&nbsp;&nbsp;</option>	
					<option value="11" {if $strASL=='11'} selected="selected"{/if}>&nbsp;&nbsp;> 0 &nbsp;&nbsp; </option>
					<option value="1"{if $strASL=='1'} selected="selected"{/if}>&nbsp;&nbsp;> 1 &nbsp;&nbsp; </option>
					<option value="2"{if $strASL=='2'} selected="selected"{/if}>&nbsp;&nbsp;> 2 &nbsp;&nbsp; </option>
					<option value="3"{if $strASL=='3'} selected="selected"{/if}>&nbsp;&nbsp;> 3 &nbsp;&nbsp; </option>
					<option value="4"{if $strASL=='4'} selected="selected"{/if}>&nbsp;&nbsp;> 4 &nbsp;&nbsp; </option>
					<option value="5"{if $strASL=='5'} selected="selected"{/if}>&nbsp;&nbsp;> 5 &nbsp;&nbsp; </option>
					<option value="6"{if $strASL=='6'} selected="selected"{/if}>&nbsp;&nbsp;> 6 &nbsp;&nbsp; </option>
					<option value="7"{if $strASL=='7'} selected="selected"{/if}>&nbsp;&nbsp;> 7 &nbsp;&nbsp; </option>
					<option value="8"{if $strASL=='8'} selected="selected"{/if}>&nbsp;&nbsp;> 8 &nbsp;&nbsp; </option>
					<option value="9"{if $strASL=='9'} selected="selected"{/if}>&nbsp;&nbsp;> 9 &nbsp;&nbsp; </option>
					<option value="10"{if $strASL=='10'} selected="selected"{/if}>&nbsp;&nbsp;>10 &nbsp;&nbsp; </option>
				</select>
				
				{if ($AppUI->admin_group_id==$smarty.const.GROUP_Marketing)}
					<label>By Campaigns: </label>
					<select name="campaign" >
						<option value="" {if $strCampaign==''} selected="selected"{/if}>&nbsp;&nbsp;All&nbsp;&nbsp;</option>	
						<option value="1"{if $strCampaign=='1'} selected="selected"{/if}>&nbsp;Ongoing Campaign&nbsp;</option>
						<option value="2"{if $strCampaign=='2'} selected="selected"{/if}>&nbsp;Upcoming Campaign&nbsp;</option>
						<option value="3"{if $strCampaign=='3'} selected="selected"{/if}>&nbsp;Closed Campaigns&nbsp;</option>
					</select>
				{/if}
				</div>
				<label>Category: </label> 
				<span class="status" style="margin-left:32px;">
					<select name="st[]" id="st" class="st_multi" multiple="multiple">
						<option value=""></option>
						{foreach from=$arrCategoryData item=status}
							<option value="{$status}" {if $status|in_array:$arrStatusId} selected{/if}>{$status}</option>
						{/foreach}
					</select>
				</span>

				<label>Reorder :</label>
				<select name="re">
					<option value="">&nbsp;+&nbsp;All</option>
					<option value="yes"{if $strReorder=='yes'} selected="selected"{/if}>&nbsp;+&nbsp;Yes</option>
					<option value="no"{if $strReorder=='no'} selected="selected"{/if}>&nbsp;+&nbsp;No</option>
				</select>
				
				<label>&nbsp;|&nbsp;
				Sort By:</label>
				<select name="orf">
					{foreach from=$arrTitle item=key}
						{if $key|in_array:$_arrExcludeColumn==0}
							{if ($AppUI->admin_group_id==$smarty.const.GROUP_Administrator)}
										{if $key|in_array:$arrAdminstrator}				
											<option value="{$key}"{if $strOrderField==$key} selected="selected"{/if}>&nbsp;+&nbsp;{$key|dragon_column_name}</option>
										{/if}	
							{elseif ($AppUI->admin_group_id==$smarty.const.GROUP_Marketing)}
										{if $key|in_array:$arrMarketing}				
											<option value="{$key}"{if $strOrderField==$key} selected="selected"{/if}>&nbsp;+&nbsp;{$key|dragon_column_name}</option>
										{/if}
							{elseif ($AppUI->admin_group_id==$smarty.const.GROUP_Buying)}
										{if $key|in_array:$arrBuying}				
											<option value="{$key}"{if $strOrderField==$key} selected="selected"{/if}>&nbsp;+&nbsp;{$key|dragon_column_name}</option>
										{/if}	
							{elseif ($AppUI->admin_group_id==$smarty.const.GROUP_Inventory)}
										{if $key|in_array:$arrInventory}				
											<option value="{$key}"{if $strOrderField==$key} selected="selected"{/if}>&nbsp;+&nbsp;{$key|dragon_column_name}</option>
										{/if}
							{/if}
						{/if}
					{/foreach}
				</select>
				<select name="orv">
					<option value="desc"{if $strOrderValue=='desc'} selected="selected"{/if}>Descending</option>
					<option value="asc"{if $strOrderValue=='asc'} selected="selected"{/if}>Ascending</option>
				</select>
				<input type="hidden" name="n" value="{$strTableName}" />
				<input type="submit" value="Filter" class="bt" />
			</form>
		</fieldset>
	</div>
<!---	<div class="r">
	{if $strType=='forecast'}
		<fieldset>
			<legend>Add more column</legend>
			<p class="msg error hide" id="null_strColumnName">Please input the column name.</p>
			<p class="msg error hide" id="null_intDataType">Please choose the data type.</p>
			<p class="msg error hide" id="err_strColumnName">The column name is exists. </p>
			<label>Column name:</label>
			<input type="text" size="30" id="strColumnName" />
			<label>Data Type:</label>
			<select id="intDataType">
				<option value="-1">Choose data type</option>
				<option value="0">&nbsp;+&nbsp;Number</option>
				<option value="1">&nbsp;+&nbsp;Text</option>
				<option value="2">&nbsp;+&nbsp;Date&nbsp;</option>
			</select>
			<input type="button" value="Add" onClick="doAddColumn();" class="bt" />
		</fieldset>
	{/if}
	</div> -->
</div>
<div style="clear:both"></div>